/// Replication file for "Kostadinova, Petia and Amie Kreppel "Loyal Agent or Shirking Partner: 
///Understanding the Policy Goals of National Ministers in the Council of the European Union",
///prepared for Journal of European Public Policy special issue 2021

/// files: JEPP_data_Feb_2021.dta ///
/// Jan_2021_Fig_marginal_effects.dta ///

use JEPP_data_Feb_2021.dta for Figure 1 and Table 1 in main text and all tables and figures in appendix. 
Use Jan_2021_Fig_marginal_effects.dta for Figure 2 in main text 

///Figure 1. Boxplot distribution of the distance between member state position and ///
///government parties’ preference, by Council formation. Figure formatted in Graph Editor
graph box absgovdeu_diff, over(coalition) over(councilrn) 

///Figure 2. Marginal effects of institutional factors on the distance between government preferences ///
///and member state position. Figure formatted in Graph Editor 
twoway (rcap bottom top at) (scatter margin at), ylabel(0(1)4) ytitle("Marginal Effects on Position-Preferences ///
Distance") ylabel(, ticks labels valuelabel grid gmax gmin) legend(off) scheme(s1mono)

///Table 1 (OLS coefficients) model 1 - all govts; model 2- all govts; ///
/// model 3 - subset coalitions; model 4 - sub-set W. Europe coalitions///
/// model 5 - subset coalitions; 
reg absgovdeu_diff coalition yearpro, vce(cluster isnrnmc) 
reg absgovdeu_diff simple_maj cab_surplus yearpro, vce(cluster isnrnmc)
reg absgovdeu_diff c.absminstrgovtwght_diff##c.cab_surplus coal_agree_bin yearpro, vce(cluster isnrnmc)
reg absgovdeu_diff c.absminstrgovtwght_diff##c.rela_portfolio_salience cab_surplus coal_agree_bin yearpro, ///
vce(cluster isnrnmc)
reg absgovdeu_diff c.absminstrgovtwght_diff##c.rela_salience cab_surplus coal_agree_bin yearpro, ///
vce(cluster isnrnmc)

///Appendix Figure A1. Boxplot distribution of the distance member state position and average ///
///government parties’ preferences, by Council formation and member state.///
///Figure formatted in Graph Editor 
graph box absgovDdeu_diff, over(ms) by(councilrn)

///Appendix Figure A2, Boxplot distribution of the distance between the average policy preferences of ///
///coalition governments and that of the respective Minister, by Council formation.///
///Figure formatted in Graph Editor
graph box absminstrgovtwght_diff, over(councilrn)

///Appendix Figure A3. Impact of interaction terms on distance between government and minister. ///
///Figure produced after two separate estimattions, merged and formatted in Graph editor.
reg absgovdeu_diff c.absminstrgovtwght_diff##c.cab_surplus coal_agree_bin yearpro, vce(cluster isnrnmc)
quietly margins, dydx(cab_surplus) at(absminstrgovtwght_diff=(.5 3 5.5) coal_agree_bin=1) atmeans
marginsplot 
reg absgovdeu_diff c.absminstrgovtwght_diff##c.rela_portfolio_salience cab_surplus coal_agree_bin yearpro, ///
vce(cluster isnrnmc)
quietly margins, dydx(rela_portfolio_salience) at(absminstrgovtwght_diff=(.5 3 5.5) coal_agree_bin=1) atmeans
marginsplot

///Appendix Table A1. Additional regression results to supplement Table 1 in the main text///
///model A1 all W European coalitions, model A2 all coalitions
reg absgovdeu_diff c.absminstrgovtwght_diff##c.rela_portfolio_salience cab_surplus yearpro,//
vce(cluster isnrnmc)
reg absgovdeu_diff c.absminstrgovtwght_diff##c.rela_salience cab_surplus yearpro, vce(cluster isnrnmc)

///Appendix Table A2.  Regression results with standard errors clustered by member state. ///
///(OLS coefficients) Model 1 All govts; Model 2 All govts; Model 3 Sub-set coalitions ///
///Model 4 Sub-set W. Europe coalitions; Model A1 All W. Europe coalitions;///
///Model 5 Sub-set coalitions; Model A2 All coalitions 
reg absgovdeu_diff coalition yearpro, vce(cluster ms)
reg absgovdeu_diff simple_maj cab_surplus yearpro, vce(cluster ms) 
reg absgovdeu_diff c.absminstrgovtwght_diff##c.cab_surplus coal_agree_bin yearpro, vce(cluster ms)
reg absgovdeu_diff c.absminstrgovtwght_diff##c.rela_portfolio_salience cab_surplus coal_agree_bin yearpro, ///
vce(cluster ms)
reg absgovdeu_diff c.absminstrgovtwght_diff##c.rela_portfolio_salience cab_surplus  yearpro, vce(cluster ms)
reg absgovdeu_diff c.absminstrgovtwght_diff##c.rela_salience cab_surplus coal_agree_bin yearpro, vce(cluster ms)
reg absgovdeu_diff c.absminstrgovtwght_diff##c.rela_salience cab_surplus yearpro, vce(cluster ms)

///Appendix Table A3. Regression results with fixed effects by member state. ///
///(OLS coefficients) Model 3 Sub-set coalitions; Model 4 Sub-set W. Europe coalitions; ///
///Model A1 All W. Europe coalitions; Model 5 Sub-set coalitions; Model A2 All coalitions
reg absgovdeu_diff c.absminstrgovtwght_diff##c.cab_surplus coal_agree_bin yearpro ///
at be bu cr cy cz de dk ee el fi fr hu ie it lt lu lv nl pl pt ro se si sk, vce(cluster isnrnmc)
reg absgovdeu_diff c.absminstrgovtwght_diff##c.rela_portfolio_salience cab_surplus coal_agree_bin yearpro ///
at be bu cr cy cz de dk ee el fi fr hu ie it lt lu lv nl pl pt ro se si sk, vce(cluster isnrnmc)
reg absgovdeu_diff c.absminstrgovtwght_diff##c.rela_portfolio_salience cab_surplus yearpro ///
at be bu cr cy cz de dk ee el fi fr hu ie it lt lu lv nl pl pt ro se si sk, vce(cluster isnrnmc)
reg absgovdeu_diff c.absminstrgovtwght_diff##c.rela_salience cab_surplus coal_agree_bin yearpro ///
at be bu cr cy cz de dk ee el fi fr hu ie it lt lu lv nl pl pt ro se si sk, vce(cluster isnrnmc)
reg absgovdeu_diff c.absminstrgovtwght_diff##c.rela_salience cab_surplus yearpro ///
at be bu cr cy cz de dk ee el fi fr hu ie it lt lu lv nl pl pt ro se si sk, vce(cluster isnrnmc)

///Appendix Table A4. Regression results with new member state control variable. ///
///(OLS coefficients) Model 3 Sub-set coalitions; Model A1 All W. Europe coalitions; 
reg absgovdeu_diff c.absminstrgovtwght_diff##c.cab_surplus yearpro newms, vce(cluster isnrnmc)
reg absgovdeu_diff c.absminstrgovtwght_diff##c.rela_salience cab_surplus yearpro newms, vce(cluster isnrnmc)

///Appendix Table A5.  Regression results with distance between PM party preferences and ///
///DEU member state position as the dependent variable. (OLS coefficients) ///
///Model 3 Sub-set coalitions; Model 4 Sub-set W. Europe coalitions; ///
///Model A1 All W. Europe coalitions; Model 5 Sub-set coalitions; Model A2 All coalitions
reg abspmdeu_diff c.absminstrgovtwght_diff##c.cab_surplus coal_agree_bin yearpro, vce(cluster isnrnmc)
reg abspmdeu_diff c.absminstrgovtwght_diff##c.rela_portfolio_salience cab_surplus coal_agree_bin yearpro, ///
vce(cluster isnrnmc)
reg abspmdeu_diff c.absminstrgovtwght_diff##c.rela_portfolio_salience cab_surplus yearpro, vce(cluster isnrnmc)
reg abspmdeu_diff c.absminstrgovtwght_diff##c.rela_salience cab_surplus coal_agree_bin yearpro, ///
vce(cluster isnrnmc)
reg abspmdeu_diff c.absminstrgovtwght_diff##c.rela_salience cab_surplus yearpro, vce(cluster isnrnmc)

///Appendix Table A6.  Regression results with difference between PM and Minister party preferences ///
///as the main independent variable.  (OLS coefficients) ///
///Model 3 Sub-set coalitions; Model 4 Sub-set W. Europe coalitions; ///
///Model A1 All W. Europe coalitions; Model 5 Sub-set coalitions; Model A2 All coalitions
reg absgovdeu_diff c.abspmminister_diff##c.cab_surplus coal_agree_bin yearpro, vce(cluster isnrnmc)
reg absgovdeu_diff c.abspmminister_diff##c.cab_surplus coal_agree_bin yearpro, vce(cluster isnrnmc)
reg absgovdeu_diff c.abspmminister_diff##c.rela_portfolio_salience cab_surplus yearpro, vce(cluster isnrnmc)
reg absgovdeu_diff c.abspmminister_diff##c.rela_salience cab_surplus coal_agree_bin yearpro, vce(cluster isnrnmc)
reg absgovdeu_diff c.abspmminister_diff##c.rela_salience cab_surplus yearpro, vce(cluster isnrnmc)

///Appendix Table A7.  Regression results with Minister’s party preferences as the main independent variable. ///
///(OLS coefficients) Model 3 Sub-set coalitions; Model 4 Sub-set W. Europe coalitions; ///
///Model A1 All W. Europe coalitions; Model 5 Sub-set coalitions; Model A2 All coalitions
reg absgovdeu_diff c.z2ministerposition##c.cab_surplus coal_agree_bin yearpro, vce(cluster isnrnmc)
reg absgovdeu_diff c.z2ministerposition##c.rela_portfolio_salience cab_surplus coal_agree_bin yearpro, ///
vce(cluster isnrnmc)
reg absgovdeu_diff c.z2ministerposition##c.rela_portfolio_salience cab_surplus yearpro, vce(cluster isnrnmc)
reg absgovdeu_diff c.z2ministerposition##c.rela_salience cab_surplus coal_agree_bin yearpro, vce(cluster isnrnmc)
reg absgovdeu_diff c.z2ministerposition##c.rela_salience cab_surplus yearpro, vce(cluster isnrnmc)

///Appendix Table A8.  Regression results with PM's party preferences as the main independent variable. ///
///(OLS coefficients) Model 3 Sub-set coalitions; Model 4 Sub-set W. Europe coalitions; ///
///Model A1 All W. Europe coalitions; Model 5 Sub-set coalitions; Model A2 All coalitions
reg absgovdeu_diff c.z2pmposition##c.cab_surplus coal_agree_bin yearpro, vce(cluster isnrnmc)
reg absgovdeu_diff c.z2pmposition##c.rela_portfolio_salience cab_surplus coal_agree_bin yearpro, ///
vce(cluster isnrnmc)
reg absgovdeu_diff c.z2pmposition##c.rela_portfolio_salience cab_surplus yearpro, vce(cluster isnrnmc)
reg absgovdeu_diff c.z2pmposition##c.rela_salience cab_surplus coal_agree_bin yearpro, vce(cluster isnrnmc)
reg absgovdeu_diff c.z2pmposition##c.rela_salience cab_surplus yearpro, vce(cluster isnrnmc)
